{% extends 'base.html' %}
{% load staticfiles %}
{% block custom_css%}
<style>
    #right {
        margin-top: 30px;
    }
    .bta,
    .bta:hover {
        color: #337ab7;
    }
</style>
{% endblock%}


{% block content %}

<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
    <div>
        <h2 class="sub-header pull-left">入住信息</h2>
        <div class="btn-group pull-right" id="right">
            <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
                过滤 <span class="caret"></span>
            </button>
            <ul class="dropdown-menu" role="menu">
                <li><a href="/enter_info?room_type=2">预定</a></li>
                <li><a href="/enter_info?room_type=1">入住</a></li>
            </ul>
        </div>
    </div>
    <div class="clearfix"></div>
    <div class="table-responsive">
        <table class="table table-striped">
            <thead>
                <tr>
                    <th>房间号</th>
                    <th>房间类型</th>
                    <th>房间状态</th>
                    <th>顾客姓名</th>
                    <th>入住人数</th>
                    <th>入住时间</th>
                    <th>预计离开时间</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                {%for order in order_list%}
                <tr>
                    <td>{{order.room_num}}</td>
                    <td>{{order.room_type}}</td>
                    <td>{{order.room_status}}</td>
                    <td>{{order.username}}</td>
                    <td>{{order.people_num}}</td>
                    <td>{{order.s_time|date:"Y-m-d"}}</td>
                    <td>{{order.e_time|date:"Y-m-d"}}</td>
                    {%if order.room_status == '预定'%}
                    <td><a type="button" class="btn btn-default bta"
                            href="/enter_info?room={{order.room_num}}&op=enter">入住</a></td>
                    {%else%}
                    <td><a type="button" class="btn btn-default bta"
                            href="/enter_info?room={{order.room_num}}&op=leave">退房</a></td>
                    {%endif%}
                </tr>
                {%endfor%}
            </tbody>
        </table>
    </div>
</div>
{% endblock %}